package com.eva.notice.biz.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

@Data
@ApiModel("系统通知概要信息")
public class SystemNoticeProfileVO {

    @JsonIgnore
    @ApiModelProperty("主键，不做返回")
    private Integer id;

    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("类型")
    private String type;

    @ApiModelProperty("内容")
    private String content;

    /**
     * 获取通知的唯一标识符，用于前端缓存标记为已读未读
     *
     * @return String
     */
    public String getUid () {
        return DigestUtils.md5DigestAsHex((String.valueOf(this.getId())).getBytes(StandardCharsets.UTF_8));
    }
}
